package org.calculator.parser;

import java.util.LinkedList;
import java.util.List;

import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;

public class LayoutHandler extends DefaultHandler {
	private List<String> lista;

	public List<String> getButtons() {
		return lista;
	}

	@Override
	public void characters(char[] ch, int start, int length)
			throws SAXException {
		super.characters(ch, start, length);
	}

	@Override
	public void endElement(String uri, String localName, String name)
			throws SAXException {
		super.endElement(uri, localName, name);
	}

	@Override
	public void startDocument() throws SAXException {
		super.startDocument();
		lista = new LinkedList<String>();
	}

	@Override
	public void startElement(String uri, String localName, String name,
			Attributes attributes) throws SAXException {

		super.startElement(uri, localName, name, attributes);

//		if (localName.equals("Button")) {
//			if (attributes.getValue("android:id") != null)
//				lista.add(new String(attributes.getValue("android:id")));
//			else
//				lista.add(new String("NO_ID"));
//		}
	}
}
